package com.projectnection.server.webservices;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.projectnection.server.database.liveFeed.SaveLiveFeed;

@SuppressWarnings("serial")
public class SaveLiveFeedServlet extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws IOException {

		String entityIDFrom = request.getParameter("entityIDFrom");

		String entityIDTo = request.getParameter("entityIDTo");

		String liveFeedDescription = request
				.getParameter("liveFeedDescription");

		SaveLiveFeed.addNew(SaveLiveFeed.loadLiveFeed(entityIDFrom, entityIDTo,
				liveFeedDescription));

		String answer = Utilities.getCallbackResponse(request
				.getParameter("callback"));

		response.setContentType("text/javascript");

		response.getWriter().println(answer);
	}
}
